from django.db import models

# Create your models here.

class UserGroup(models.Model):
    """用户组表"""
    title = models.CharField(max_length=32)

class Role(models.Model):
    """角色表"""
    title = models.CharField(max_length=32)

class UserInfo(models.Model):
    """用户表"""
    user_type_choices = (
        (1,"普通用户"),
        (2,"vip用户"),
        (3,"svip用户"),
    )
    username = models.CharField(max_length=32,unique=True)
    password = models.CharField(max_length=64)
    user_type = models.IntegerField(choices=user_type_choices)
    group = models.ForeignKey(UserGroup,on_delete=models.CASCADE)
    roles = models.ManyToManyField(Role)


